package com.tensquare.base.dao;

import com.tensquare.base.pojo.Label;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * 标签数据访问接口
 */
public interface LabelDao extends JpaRepository<Label, String>, JpaSpecificationExecutor<Label> {

    @Query(value = "SELECT * FROM tb_label WHERE state=1 ORDER BY `count` DESC,fans DESC LIMIT 0,5 ", nativeQuery = true)
    public List<Label> topList();

   // @Query(value = "SELECT * FROM tb_label WHERE id in (?)", nativeQuery = true)
    //List<Label> findByids(@Param("ids") String[] ids);

    List<Label> findByIdIn(String[] ids);
}
